package com.ruoyi.ade.analyze;

/**
 *
 */
public class LabResult {

    private Long labId;  //所属实验ID
    private String adeMatchLevel;  //匹配级别  L1/L2/L3
    private int total;  //样本总数  tp+tn+fp+fn
    private int tp;    //真阳
    private int tn;    //真阴
    private int fp;    //假阳
    private int fn;    //假阴
    private float fpr;  //假正率 误报率  fp/(fp+tn)
    private float fnr;  //假负率 漏报率  fn/(fn+tp)
    private float precision;  //准确率 查准率  tp/(tp+fp)
    private float recall;  //召回率 灵敏度 tp/(tp+fn)
    private float accuracy;  //准确度  (tp+tn)/(tp+fp+fn+tn)
    private float specificity; //特异度  tn/(tn+fp)
    private float f1;  //F1-score  2*precision*recall/(precision+recall)


    public LabResult(Long labId, String adeMatchLevel,int tp, int tn, int fp, int fn) {
        this.labId = labId;
        this.adeMatchLevel = adeMatchLevel;
        this.tp = tp;
        this.tn = tn;
        this.fp = fp;
        this.fn = fn;
        this.total = tp+tn+fp+fn;
        this.precision = tp/(float)(tp+fp);
        this.recall = tp/(float)(tp+fn);
        this.specificity = tn/(float)(tn+fp);
        this.f1 = 2*precision*recall/(precision+recall);
        this.fpr = fp/(float)(fp+tn);
        this.fnr = fn/(float)(fn+tp);
        this.accuracy = (tp+tn)/(float)(tp+tn+fp+fn);
    }

    public Long getLabId() {
        return labId;
    }

    public void setLabId(Long labId) {
        this.labId = labId;
    }

    public String getAdeMatchLevel() {
        return adeMatchLevel;
    }

    public void setAdeMatchLevel(String adeMatchLevel) {
        this.adeMatchLevel = adeMatchLevel;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getTp() {
        return tp;
    }

    public void setTp(int tp) {
        this.tp = tp;
    }

    public int getTn() {
        return tn;
    }

    public void setTn(int tn) {
        this.tn = tn;
    }

    public int getFp() {
        return fp;
    }

    public void setFp(int fp) {
        this.fp = fp;
    }

    public int getFn() {
        return fn;
    }

    public void setFn(int fn) {
        this.fn = fn;
    }

    public float getFpr() {
        return fpr;
    }

    public void setFpr(float fpr) {
        this.fpr = fpr;
    }

    public float getFnr() {
        return fnr;
    }

    public void setFnr(float fnr) {
        this.fnr = fnr;
    }

    public float getPrecision() {
        return precision;
    }

    public void setPrecision(float precision) {
        this.precision = precision;
    }

    public float getRecall() {
        return recall;
    }

    public void setRecall(float recall) {
        this.recall = recall;
    }

    public float getAccuracy() {
        return accuracy;
    }

    public void setAccuracy(float accuracy) {
        this.accuracy = accuracy;
    }

    public float getSpecificity() {
        return specificity;
    }

    public void setSpecificity(float specificity) {
        this.specificity = specificity;
    }

    public float getF1() {
        return f1;
    }

    public void setF1(float f1) {
        this.f1 = f1;
    }
}
